import greenfoot.*;

/**
 * This class defines a crab. Crabs live on the beach.
 */
public class Crab extends Actor
{
 public void act()
    {
      move(5) ;
      trnAtEdge();
      cntrol();
}
public void trnAtEdge() {
if(isAtEdge()) {
          turn(30);
        }
}
public void cntrol(){
      if(Greenfoot.isKeyDown("down")) {
       turn(-15);
}
if(Greenfoot.isKeyDown("right")){
   move(3);
} 
if(Greenfoot.isKeyDown("up")){
    turn(25);
}
if(Greenfoot.isKeyDown("left")){
   move(-3);
} 
}
}
